<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="/common_head :: commonHead('fileUpload')"></head>
<body>
<div class="page-container">
    <div class="left-content">
        <div class="inner-content">
            <div class="header-section">
                <div th:include="/header :: header"></div>
                <div class="clearfix"></div>
            </div>
            <div class="outter-wp">
                <div class="sub-heard-part">
                    <ol class="breadcrumb m-b-0">
                        <li><a href="index.html">Home</a></li>
                        <li class="active">file</li>
                    </ol>
                </div>
                <div class="graph-visual">
                    <h2 class="inner-tittle">文件工具</h2>
                    <div class="graph">
                        <div class="map_container">
                            <div class="col-md-4" th:fragment="file-upload">
                                <form method="post" enctype="multipart/form-data">
                                    <input type="file"  name="file" id="file"/>
                                    <input type="text" name="filepath" value="/images/avatar" hidden="hidden"/>
                                    <input class="form-control" type="submit" id="upload" value="上传"/>
                                </form>
                            </div>
                            <div class="col-md-4">
                                <form method="post" action="http://localhost:8097/jsonToExcel" enctype="multipart/form-data">
                                    <input type="file"  name="jsonFile" id="jsonFile"/>
                                    <input class="form-control" type="submit" id="json-excel" value="json转换excel" />
                                </form>
                            </div>
                            <div class="col-md-4">
                                <form method="post" action="http://localhost:8097/excelToJson" enctype="multipart/form-data">
                                    <input type="file"  name="excelFile" id="excelFile"/>
                                    <input class="form-control" type="submit" id="excel-json" value="excel转换json"/>
                                </form>
                            </div>
                        </div>
                </div>
            </div>
            <footer th:include="/footer :: footer">
            </footer>

        </div>
    </div>
    <!--//content-inner-->
    <!--/sidebar-menu-->
    <div class="sidebar-menu" th:include="/sidebar :: sidebar"></div>
    <div class="clearfix"></div>
</div>



<script >
    $("#upload").click(function () {
        var form=new FormData();
        form.append("file",$("#file")[0].files[0]);
        $.ajax({
            type: 'post',
            url:'fileUpload',
            data:form,
            processData: false,
            contentType: false,
            success: function (data) {
                alert(data)
            },
            error: function () {
            }
        });
    })
</script>
</body>
</html>